package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqPackageChargeFeeSheet;
import com.ruoyi.hqfinance.domain.vo.HqPackageChargeFeeSheetVo;
import com.ruoyi.hqfinance.mapper.HqPackageChargeFeeSheetMapper;
import com.ruoyi.hqfinance.service.HqPackageChargeFeeSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqPackageChargeFeeSheetServiceImpl implements HqPackageChargeFeeSheetService {
    @Autowired
    private HqPackageChargeFeeSheetMapper hqPackageChargeFeeSheetMapper;
    @Override
    public List<HqPackageChargeFeeSheet> collect(HqPackageChargeFeeSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqPackageChargeFeeSheet> sheets = hqPackageChargeFeeSheetMapper.collect(vo);
        assert sheets != null;
        for (HqPackageChargeFeeSheet hqPackageChargeFeeSheet : sheets){
            if (vo.getDateType() == 2){
                hqPackageChargeFeeSheet.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
            hqPackageChargeFeeSheet.setPackageType("转运中心");
        }
        return sheets;
    }
}
